package leetcode.L500;

public class EX104 {
    int ans = 0;
    public int maxDepth(TreeNode root) {
        if(root == null){
            return 0;
        }
        int deep=1;
        help(root,deep);
        return ans;

    }
    private void help(TreeNode root,int deep){
        if(root==null){
            ans = Math.max(ans,deep);
        }

            help(root.left, deep + 1);
            help(root.right, deep + 1);
    }


}
